<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>求数组中的最大偶数</title>
	</head>
	<body>
		<script type="text/javascript">
			var arr = [1,2,3,4,5,6,7,8,9,10]
			var res = []
			for(let i = 0; i < arr.length; i++) {
				// 判断偶数
				if(arr[i] % 2 == 0) {
					res.push(arr[i])
				}
			}
			// 假设 res[0] 是最大值
			var sum = res[0]
			for(let j = 0; j < res.length; j++) {
				// 判断 res 数组中的值 > sum
				if(res[j] > sum) {
					sum = res[j]
				}
			}
			console.log(sum)
		</script>
	</body>
</html>
